<template>
  <div class="app">
    <h3>我是app组件</h3>
    <Suspense>
      <template v-slot:default>
        <Child />
      </template>
      <template v-slot:fallback>
        <h3>稍等，加载中....</h3>
      </template>
    </Suspense>
  </div>
</template>

<script>
// import Child from './components/Child.vue'
import { defineAsyncComponent } from 'vue' //静态引入
const Child = defineAsyncComponent(() => import('./components/Child.vue'))
export default {
  name: 'app',
  components: {
    Child
  }
}
</script>

<style>
.app {
  background-color: pink;
  padding: 10px;
}
</style>
